package data

import (
	"context"

	"github.com/go-kratos/kratos/v2/log"

	"poetize/app/service/user/internal/biz"
)

// userRepo 实现 biz.UserRepo 接口
// 私有的结构体
// 对“/biz/user.go”中的UserRepo进行实现，
// 完成对“用户数据模型”的数据库基础操作。
type userRepo struct {
	data *Data // 数据库客户端的集合
	log  *log.Helper
}

// NewUseRepo .
// 注意这里返回的是 biz.UserRepo
// 在golang中接口的继承是不需要明确声明的
// 只要我们的私有结构体userRepo实现了“/biz/user.go”内 biz.UserRepo 接口内的方法
// 那么 userRepo 就是“继承”了 biz.UserRepo
func NewUseRepo(data *Data, logger log.Logger) biz.UserRepo {
	return &userRepo{
		data: data,
		log:  log.NewHelper(logger),
	}
}

func (u userRepo) Regist(ctx context.Context, model *biz.User) (*biz.User, error) {
	res := u.data.DataBase.Create(model)
	if res.Error != nil {
		return nil, res.Error
	}
	return model, nil
}

func (u userRepo) LoginUser(ctx context.Context, model *biz.User) (uint, error) {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) GetUserByID(ctx context.Context, id uint) (*biz.User, error) {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) GetUserByUsername(ctx context.Context, username string) (*biz.User, error) {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) GetUserByOpenID(ctx context.Context, openID string) (*biz.User, error) {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) UpdateUser(ctx context.Context, model *biz.User) error {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) DeleteUser(ctx context.Context, id uint) error {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) GetUserList(ctx context.Context, page, pageSize int) ([]*biz.User, error) {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) GetUserCount(ctx context.Context) (int64, error) {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) GetUserByPhoneNumber(ctx context.Context, phoneNumber string) (*biz.User, error) {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) GetUserByEmail(ctx context.Context, email string) (*biz.User, error) {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) GetUserByUsernameAndPassword(ctx context.Context, username, password string) (*biz.User, error) {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) GetUserByPhoneNumberAndPassword(ctx context.Context, phoneNumber, password string) (*biz.User, error) {
	//TODO implement me
	panic("implement me")
}

func (u userRepo) GetUserByEmailAndPassword(ctx context.Context, email, password string) (*biz.User, error) {
	//TODO implement me
	panic("implement me")
}
